import requests
from lxml import etree

url="https://www.ip.cn"
headers={
    "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36 OPR/57.0.3098.116", }
pro={
    # 'https': 'https://118.122.92.252:37901', #四川省成都市 电信
    'https': 'https://101.254.136.130:443',  # 湖北省武汉市 电信
    }
try:
    response=requests.get(url, headers=headers, proxies=pro)
    html_str=response.content.decode()
    print(html_str)
    html=etree.HTML(html_str)
    message=html.xpath("//div[@class='well']//p/text()")
    ip=html.xpath("//div[@class='well']//p/code/text()")
    eng=html.xpath("//div[@class='well']/p/text()")
    print(message[0] + ip[0])
    print(message[1] + ip[1])
    print(eng[2])
except requests.exceptions.ProxyError as e:
    print("当前代理异常")
except:
    print("当前请求异常")